<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link type="text/css" rel="stylesheet" href="css/company.css"/>
    <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="js/company.js"></script>
    <title>职位信息</title>
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        const constPname = sessionStorage.getItem('pname');
        const constBusiness = sessionStorage.getItem('business');

        $(document).ready(function () {


            /**
             * 对职位信息的展示
             */
            $.get("EnterpriceAndPosts/showPosts", {"pname": constPname}, function (pos) {
                //设置职位名称
                $("#pname").text(pos.pname);
                //设置标签
                $(" <label>" + pos.jlale + "</label>").appendTo(".bqbox");
                //设置其他属性
                $("#local").text("工作地点:" + pos.local);
                $("#sal").text("职位月薪:" + pos.sal);
                $("#need").text("招聘人数:" + pos.needNumber);
                $("#degree").text("最低学历:" + pos.degree);
                $("#age").text("年龄要求:" + pos.age);
                $("#work").text("工作经验:" + pos.workExperience);
                $("#way").text("招聘方式:" + pos.recruitType);
                $("#date").text("刷新日期:" + pos.lastTime);
                $("#pduty").text(pos.pduty);
                $("#jreQuest").text(pos.jreQuest);

            });

            /**
             * 对公司信息进行展示
             */
            $.get("EnterpriceAndPosts/showEnterprise", {"business": constBusiness}, function (bus) {
                //修改公司名字
                $("#business").text(bus.business);
                //设置其他属性
                $("#industry").text("行业:" + bus.industry);
                $("#quality").text("性质:" + bus.quality);
                $("#scale").text("规模:" + bus.scale);
                $("#businessHomepage").text("企业主页:" + bus.businessHomepage);
                $("#fullAddress").text("详细地址:" + bus.fullAddress);
                $("#companyIntroduction").text(bus.companyIntroduction);
            });
            /**
             * 对申请状态进行判断,并且如果没有申请可直接进行申请
             */
            $.get("EnterpriceAndPosts/showPosts", {"pname": constPname}, function (pos) {
                var pid = pos.pid;
                var phone = 13633249902;
                $.get("EnterpriceAndPosts/astatus", {"pid": pid, "phone": phone}, function (boo) {
                    if (boo) {
                        $("#astatus").text("已申请");
                    } else {
                        $("#astatus").text("立即申请");
                        $(document).on("click", "#astatus", function () {
                          const uid = sessionStorage.getItem("uid")
                            $.get("EnterpriceAndPosts/addastatus", {"pid": pid, "phone": phone,"uid":uid}, function (mess) {
                                if (mess) {
                                    alert("申请成功！");
                                } else {
                                    alert("申请失败！");
                                }
                            });
                        });
                    }
                });

            });

        });

    </script>
</head>

<body>
<div class="compHeader">
    <div class="main">
        <div class="header_l">
            <a href="../../../../target/classes/public/index.html">
                <img src="images/logo_1.png"/>
                <img src="images/logo_2.png"/>
            </a>
            <span>www.xxx.com</span>
        </div>
        <div class="header_c">
            <input name="shuru" type="text" placeholder="请输入关键字..." class="keyword"/>
            <input name="提交" type="button" class="btnsearch"/>
        </div>
        <div class="header_r">
            <a href="login.html">个人登录</a>
            <a href="register.html">注册</a>
        </div>
    </div>
</div>

<div class="jobtypeBox">
    <div class="DivLeft">
        <div class="DivCompany">
            <div class="DivCompany_img"><img src="images/company.gif" width="180"/></div>
            <h1><a id="business" href="company.html"> </a><img src="images/16.png"/></h1>
            <div class="clear"></div>
            <div class="DivLeft_2">
                <p id="industry"></p>
                <p id="quality"></p>
                <p id="scale"></p>
                <p id="businessHomepage"></p>
                <p id="fullAddress"></p>
                <p id="companyIntroduction"></p>
            </div>
            <div class="clear"></div>
        </div>
    </div>
    <div class="DivRight">
        <div class="DivRight_2">
            <div class="divJob_1">
                <div class="divJob_l">
                    <div class="tit">

                        <h2 id="pname"></h2>
                        <div class="clear"></div>
                    </div>
                    <div class="bqbox">


                        <div class="clear"></div>
                    </div>

                    <div id="local" class="jobsub"></div>
                    <div id="sal" class="jobsub"></div>
                    <div id="need" class="jobsub"></div>
                    <div id="degree" class="jobsub"></div>
                    <div id="age" class="jobsub"></div>
                    <div id="work" class="jobsub"></div>
                    <div id="way" class="jobsub"></div>
                    <div id="date" class="jobsub"></div>
                </div>
            </div>
            <div class="clear"></div>
            <div class="divJob_2">
                <div id="astatus" class="divJob_2_1"></div>
            </div>
            <div class="clear"></div>
            <div class="divJob_3">
                <b>岗位职责：</b><br/>
                <div id="pduty" class="con">

                </div>
                <b>岗位要求：</b><br/>
                <div id="jreQuest" class="con">

                </div>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>

<div class="clear"></div>
<div class="footer">
</div>
</body>
</html>
